package com.heima.listener;

import org.apache.commons.lang3.StringUtils;
import org.springframework.kafka.annotation.KafkaListener;
import org.springframework.stereotype.Component;

@Component
public class TestListener {
	@KafkaListener(topics = "hello", groupId = "group1")
	public void getMessage(String message) throws InterruptedException {
		if (!StringUtils.isEmpty(message)) {
			System.out.println("我是1号");
			// Thread.sleep(1000);
			System.out.println(message);
			// throw new Exception();
			
		}
	}
	
	@KafkaListener(topics = "hello", groupId = "group1")
	public void getMessage2(String message) {
		if (!StringUtils.isEmpty(message)) {
			System.out.println("我是2号");
			System.out.println(message);
		}
	}
}
